package com.ramon.ohcda.util;

public class Constants {
    public static final String macArcPath="/Users/gillbates/Desktop/arcs";
    		
    public static final String windowsArcPath="e:/temp/arcs";
    
    public static final String testHtml1="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n" + 
    		"<html>\n" + 
    		"<head>\n" + 
    		"<title>Java md5 example with MessageDigest</title>\n" + 
    		"        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' lang='en'>\n" + 
    		"        <script type='text/javascript' src='http://www.spiration.co.uk/js/channels.js'></script>\n" + 
    		"        <link rel='stylesheet' type='text/css' href='http://www.spiration.co.uk/css/normalize.css' />\n" + 
    		"        <link rel='stylesheet' type='text/css' href='http://www.spiration.co.uk/css/torkalot.css' />\n" + 
    		"</head>\n" + 
    		"<body>\n" + 
    		"        <div id='breadcrumbstrip'>\n" + 
    		"\n" + 
    		"                        <h2 id='breadcrumb'><a href='http://www.spiration.co.uk/channel/1'>Spiration Home</a> > <a href='http://www.spiration.co.uk/channel/66'>Computing</a> > <a href='http://www.spiration.co.uk/channel/122'>Programming</a> > <a href='http://www.spiration.co.uk/channel/131'>Java</a> > </h2>\n" + 
    		"                    <span id='loginstrip'><div>\n" + 
    		"        <form action='http://www.spiration.co.uk/login.php' method='post'>\n" + 
    		"\n" + 
    		"           <div class='stripinput'><label>user</label><input type='text' name='username'></input></div>\n" + 
    		"           <div class='stripinput'><label>password</label> <input type='password' name='password'></input></div>\n" + 
    		"       <div class='stripinput'><input class='minisubmitbutton' type='image' name='submit' value='submit' src='http://www.spiration.co.uk/images/icon_login_ccc.gif' alt='login button' /></input></div>\n" + 
    		"    <div class='stripinput'><span class='smalllink'><a href='#'>forgotten</a></span></div>\n" + 
    		"    <div class='stripinput'><a class='smalllink' href='http://www.spiration.co.uk/join'>join</a></div>\n" + 
    		"        </form>\n" + 
    		"\n" + 
    		"</div>\n" + 
    		"</span>\n" + 
    		"                </div>\n" + 
    		"</div>\n" + 
    		"<div id='leftcolumn'>\n" + 
    		"<script type='text/javascript'><!--\n" + 
    		"google_ad_client = 'pub-5779114772423033';\n" + 
    		"//160x600, created 1/1/08\n" + 
    		"google_ad_slot = '0786182679';\n" + 
    		"google_ad_width = 160;\n" + 
    		"google_ad_height = 600;\n" + 
    		"//--></script>\n" + 
    		"<script type='text/javascript'\n" + 
    		"src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>\n" + 
    		"</script>\n" + 
    		" </div>\n" + 
    		"    <div id='post'>\n" + 
    		"        <div id='post-head'>\n" + 
    		"\n" + 
    		"            <div id='post-title'>\n" + 
    		"                <h1>Java md5 example with MessageDigest</h1>\n" + 
    		"                <span id='poster'>chris (2004-09-09 11:51:40)</span>\n" + 
    		"            </div>\n" + 
    		"            <div id='post-info'>\n" + 
    		"                <div>82171 views</div>\n" + 
    		"                <div>13 replies</div>\n" + 
    		"\n" + 
    		"            </div>\n" + 
    		"        </div>\n" + 
    		"        <div class='post-text'>\n" + 
    		"            <!--img class='addstrip' src='http://www.spiration.co.uk/images/468x15_4.gif' /-->\n" + 
    		"<div class='square'>\n" + 
    		"<script type='text/javascript'><!--\n" + 
    		"google_ad_client = 'pub-5779114772423033';\n" + 
    		"/* 250x250, created 2/25/08 */\n" + 
    		"google_ad_slot = '2909226682';\n" + 
    		"google_ad_width = 250;\n" + 
    		"google_ad_height = 250;\n" + 
    		"//-->\n" + 
    		"</script>\n" + 
    		"<script type='text/javascript'\n" + 
    		"src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>\n" + 
    		"</script>\n" + 
    		"</div>\n" + 
    		"            This is a quick tip for implementing md5 encryption in java. We use the MessageDigest class in the java.security package and some string manipulation to turn the plain text into a byte array. The digest is then updated from the bytes from the byte array and a hash computation is conducted upon them. To quote from the Sun java api docs, The MessageDigest class provides applications the functionality of a message digest algorithm, such as MD5 or SHA. Message digests are secure one-way hash functions that take arbitrary-sized data and output a fixed-length hash value. <br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"Anyway the md5 example code below takes a session id (this is just a string which I wanted to encrypt - It could just as easily be a document, say a lump of xml or any old bit of text). This session id is pulled into the bytes array, defaultBytes and then the MessageDigest is instantiated as an instance of an md5 encryption.<br />\n" + 
    		"<br />\n" + 
    		"Java developers who have come over from PERL or PHP often get frustrated with such a longwinded means of running what could simply be a single line of code, however the snippet below could be wrapped into an md5sum class which conducts the encryption and simply returns a string of cipher text.<br />\n" + 
    		"<code><pre>\n" + 
    		"include java.security.*;\n" + 
    		"\n" + 
    		"... etc\n" + 
    		"\n" + 
    		"sessionid=&quot;12345&quot;;\n" + 
    		"        \n" + 
    		"byte[] defaultBytes = sessionid.getBytes();\n" + 
    		"try{\n" + 
    		"    MessageDigest algorithm = MessageDigest.getInstance(&quot;MD5&quot<img class='emote' src='http://www.spiration.co.uk/images/smilies/wink.gif'/>;\n" + 
    		"    algorithm.reset();\n" + 
    		"    algorithm.update(defaultBytes);\n" + 
    		"    byte messageDigest[] = algorithm.digest();\n" + 
    		"            \n" + 
    		"    StringBuffer hexString = new StringBuffer();\n" + 
    		"    for (int i=0;i&lt;messageDigest.length;i++) {\n" + 
    		"        hexString.append(Integer.toHexString(0xFF &amp; messageDigest[i]));\n" + 
    		"    }\n" + 
    		"    String foo = messageDigest.toString();\n" + 
    		"    System.out.println(&quot;sessionid &quot;+sessionid+&quot; md5 version is &quot;+hexString.toString());\n" + 
    		"    sessionid=hexString+&quot;&quot;;\n" + 
    		"}catch(NoSuchAlgorithmException nsae){\n" + 
    		"            \n" + 
    		"}\n" + 
    		"\n" + 
    		"</pre></code>\n" + 
    		"<br />\n" + 
    		"Remember to import the java.security package. The original plain text and cipher text strings are echod to the java console just to demonstrate what has happened.<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"Hope that&#039;s useful,<br />\n" + 
    		"<br />\n" + 
    		"christo<br />\n" + 
    		"<br />\n" + 
    		"follow me on twitter: <a href='http://www.twitter.com/planet_guru'>http://www.twitter.com/planet_guru</a>       </div>\n" + 
    		"\n" + 
    		"                <div id='post-submissions'>\n" + 
    		"            \n" + 
    		"<a href='http://digg.com/submit?phase=2&url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Digg it!'><img src='http://www.spiration.co.uk/images/add_to_digg.jpg' alt='Digg it!' border='0'></a>\n" + 
    		"\n" + 
    		"<a href='http://slashdot.org/submit.pl' title='Submit to Slashdot'><img src='http://www.spiration.co.uk/images/add_to_slashdot.jpg' alt='Submit to Slashdot' border='0'></a>\n" + 
    		"\n" + 
    		"<a href='http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&Title=Java md5 example with MessageDigest' title='Add it to BinkList'><img src='http://www.spiration.co.uk/images/add_to_binklist.jpg' border='0' alt='Add to Blinklist'></a>\n" + 
    		"\n" + 
    		"<a href='http://del.icio.us/post?url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Del.Icio.Us'><img src='http://www.spiration.co.uk/images/add_to_delicious.jpg' border='0' alt='Del.icio.us'></a>\n" + 
    		"\n" + 
    		"<a href='http://www.newsvine.com/_tools/seed&save?u=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&h=Java md5 example with MessageDigest' title='Add it to NewsVine'><img src='http://www.spiration.co.uk/images/add_to_newsvine.jpg' border='0' alt='Add to Newsvine'></a>\n" + 
    		"\n" + 
    		"<a href='http://technorati.com/faves?add=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Add to Technorati'><img src='http://www.spiration.co.uk/images/add_to_technorati.jpg' border='0' alt='Add to Technorati'></a>\n" + 
    		"\n" + 
    		"<a href='http://www.google.com/bookmarks/mark?op=add&bkmk=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Add it to Google Bookmarks'><img src='http://www.spiration.co.uk/images/add_to_google.jpg' border='0' alt='Add it to Google Bookmarks'></a>\n" + 
    		"\n" + 
    		"<a href='http://ma.gnolia.com/bookmarklet/add?url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&description=Java md5 example with MessageDigest' title='Add to Magnolia'><img src='http://www.spiration.co.uk/images/add_to_magnolia.jpg' alt='Add to Magnolia' border='0'></a>\n" + 
    		"                </div>\n" + 
    		"                <div id='post-tools'>\n" + 
    		"            <a href='http://www.spiration.co.uk/reply/p/1199' title='reply to this post'/>comment</a>       </div><!-- end post tools-->\n" + 
    		"    </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href=''>gipak</a></div>\n" + 
    		"                    <div>2004-09-23 09:11:47</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>not exactly correct</h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                if you use Integer.toHexString(int a), if a&gt;=0 and a&lt;=15 you will get a String consisting of only one char!!!! you need to do something like this:<br />\n" + 
    		"<br />\n" + 
    		"<code><pre>\n" + 
    		"StringBuffer sb=new StringBuffer();\n" + 
    		"for (int i = 0; i &lt; bytes.length; i++) {\n" + 
    		"     String hex=Integer.toHexString(0xff &amp; bytes[i]);\n" + 
    		"     if(hex.length()==1) sb.append(&#039;0&#039;);\n" + 
    		"     sb.append(hex);\n" + 
    		"}\n" + 
    		"</pre></code>           </div>\n" + 
    		"\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1269' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    		"\n" + 
    		"                    <div>2006-12-18 16:59:38</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>Java md5 example with MessageDigest - - immer 32 z</h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                Vielen Dank f&uuml;r dieses Beispiel,<br />\n" + 
    		"\n" + 
    		"ich bin mal so frei und hab den Code aufbereitet, das er passt.<br />\n" + 
    		"D.h. es kommt als Ergebnis immer ein g&uuml;ltiger 32 Zeichel&auml;nge MD5-String raus.<br />\n" + 
    		"<br />\n" + 
    		"<code><pre>\n" + 
    		"import java.security.*;\n" + 
    		"\n" + 
    		"... etc\n" + 
    		"\n" + 
    		"String pass = &quot;123456&quot;;\n" + 
    		"\n" + 
    		"\n" + 
    		"byte[] defaultBytes = pass.getBytes();\n" + 
    		"try{\n" + 
    		"     MessageDigest algorithm = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    		"     algorithm.reset();\n" + 
    		"     algorithm.update(defaultBytes);\n" + 
    		"     byte messageDigest[] = algorithm.digest();\n" + 
    		"\n" + 
    		"     StringBuffer hexString = new StringBuffer();\n" + 
    		"     for (int i=0;i&lt;messageDigest.length;i++) {\n" + 
    		"    String hex = Integer.toHexString(0xFF &amp; messageDigest[i]); \n" + 
    		"    if(hex.length()==1)\n" + 
    		"    hexString.append(&#039;0&#039;);\n" + 
    		"\n" + 
    		"    hexString.append(hex);\n" + 
    		"     }\n" + 
    		"                             \n" + 
    		"                             \n" + 
    		"     //*** Testausgabe\n" + 
    		"     System.out.println(&quot;pass &quot;+pass+&quot;   md5 version is &quot;+hexString.toString());\n" + 
    		"     pass = hexString+&quot;&quot;;\n" + 
    		"}\n" + 
    		"catch(NoSuchAlgorithmException nsae){\n" + 
    		"                                            \n" + 
    		"}\n" + 
    		"\n" + 
    		"</pre></code>\n" + 
    		"<br />\n" + 
    		"Danke an Euch Zwei. ICh w&auml;re da selbst nicht drauf gekommen.           </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1416' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    		"                    <div>2006-11-28 16:43:09</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>Thanks!</h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                These codes were very useful to me !<br />\n" + 
    		"Thank you!          </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1413' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    		"                    <div>2007-03-30 09:36:31</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2></h2>\n" + 
    		"                </div>\n" + 
    		"\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                The following code works well if you only need to print the digest value:<br />\n" + 
    		"<br />\n" + 
    		"for (byte b : md.digest())<br />\n" + 
    		"  System.out.printf(&quot;%02x&quot;, 0xFF&amp;b);          </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1426' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    		"                    <div>2007-03-30 15:38:19</div>\n" + 
    		"\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>SHA-256</h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                Cheers.<br />\n" + 
    		"<br />\n" + 
    		"<code><pre>\n" + 
    		"\n" + 
    		"package test;\n" + 
    		"\n" + 
    		"import java.security.MessageDigest;\n" + 
    		"import java.security.NoSuchAlgorithmException;\n" + 
    		"\n" + 
    		"public class MD5Test\n" + 
    		"{\n" + 
    		"    public static void main(String[] args)\n" + 
    		"    {\n" + 
    		"        String md5val = &quot;&quot;;\n" + 
    		"        MessageDigest algorithm = null;\n" + 
    		"\n" + 
    		"        try\n" + 
    		"        {\n" + 
    		"            algorithm = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    		"        }\n" + 
    		"        catch (NoSuchAlgorithmException nsae)\n" + 
    		"        {\n" + 
    		"            System.out.println(&quot;Cannot find digest algorithm&quot;);\n" + 
    		"            System.exit(1);\n" + 
    		"        }\n" + 
    		"        \n" + 
    		"        for (String arg : args)\n" + 
    		"        {\n" + 
    		"            byte[] defaultBytes = arg.getBytes();\n" + 
    		"            algorithm.reset();\n" + 
    		"            algorithm.update(defaultBytes);\n" + 
    		"            byte messageDigest[] = algorithm.digest();\n" + 
    		"            StringBuffer hexString = new StringBuffer();\n" + 
    		"\n" + 
    		"            for (int i = 0; i &lt; messageDigest.length; i++)\n" + 
    		"            {\n" + 
    		"                String hex = Integer.toHexString(0xFF &amp; messageDigest[i]);\n" + 
    		"                if (hex.length() == 1)\n" + 
    		"                {\n" + 
    		"                    hexString.append(&#039;0&#039;);\n" + 
    		"                }\n" + 
    		"                hexString.append(hex);\n" + 
    		"            }\n" + 
    		"            md5val = hexString.toString();\n" + 
    		"            System.out.println(&quot;MD5 (&quot;&quot; + arg + &quot;&quot;) = &quot; + md5val);\n" + 
    		"        }\n" + 
    		"    }\n" + 
    		"}\n" + 
    		"\n" + 
    		"</pre></code>\n" + 
    		"<br />\n" + 
    		"this lets you test on the command line against the command line md5 command to check it works correctly:<br />\n" + 
    		"<br />\n" + 
    		"<code><pre>\n" + 
    		"g@h ~/bin$ md5 -s dammitjanet\n" + 
    		"MD5 (&quot;dammitjanet&quot;) = ea309a2eb146a4d8bdf8946c4df23c71\n" + 
    		"g@h ~/bin$ java -cp . test.MD5Test dammitjanet\n" + 
    		"MD5 (&quot;dammitjanet&quot;) = ea309a2eb146a4d8bdf8946c4df23c71\n" + 
    		"</pre></code>\n" + 
    		"<br />\n" + 
    		"Please note that if you are using MD5 for authentication means, you really really should consider using a salt alongside the value you wish to create an md5 of to increase security. Better to use SHA-256 although you need to use more characters in your database password table.<br />\n" + 
    		"<br />\n" + 
    		"        algorithm = MessageDigest.getInstance(&quot;SHA-256&quot;);<br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"<code><pre>\n" + 
    		"g@h ~/bin$ java -cp . test.MD5Test &quot;bark at the moon&quot;  \n" + 
    		"SHA-256 (&quot;bark at the moon&quot;) = a5bb786220762b74c9569cd9f150a4176f9da3c2ac29d776a65487b2a77d4429\n" + 
    		"</pre></code>\n" + 
    		"            </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1427' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href=''>iandesouza</a></div>\n" + 
    		"                    <div>2007-05-17 17:27:19</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>shorter version</h2>\n" + 
    		"\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                You can use BigInteger to do the byte array conversion....<br />\n" + 
    		"<code><pre>\n" + 
    		"    static String getMd5Digest(String input)\n" + 
    		"        {\n" + 
    		"            try\n" + 
    		"            {\n" + 
    		"                MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    		"                byte[] messageDigest = md.digest(input.getBytes());\n" + 
    		"                BigInteger number = new BigInteger(1,messageDigest);\n" + 
    		"                return number.toString(16);\n" + 
    		"            }\n" + 
    		"            catch(NoSuchAlgorithmException e)\n" + 
    		"            {\n" + 
    		"                throw new RuntimeException(e);\n" + 
    		"            }\n" + 
    		"        }\n" + 
    		"</pre></code>\n" + 
    		"            </div>\n" + 
    		"\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1551' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href=''>pedroha</a></div>\n" + 
    		"\n" + 
    		"                    <div>2007-05-21 19:35:08</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>Short correction</h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                I liked the short version, so I used it but it didn&#039;t match during my testing.<br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"I tried with the following input:<br />\n" + 
    		"&quot;bbb&quot;: 8F8E0260C64418510CEFB2B06EEE5CD<br />\n" + 
    		"<br />\n" + 
    		"So I checked against MySQL md5():<br />\n" + 
    		"08F8E0260C64418510CEFB2B06EEE5CD<br />\n" + 
    		"<br />\n" + 
    		"You have to prepend zero&#039;s until you get 32 chars to simulate this behaviour.<br />\n" + 
    		"<br />\n" + 
    		"Regards,<br />\n" + 
    		"\n" + 
    		"Pedro<br />\n" + 
    		"<br />\n" + 
    		"            </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1552' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>jn</a></div>\n" + 
    		"                    <div>2008-05-26 06:07:07</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2></h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                <blockquote class='quote'>You can use BigInteger to do the byte array conversion....<br />\n" + 
    		"<code><pre>\n" + 
    		"    static String getMd5Digest(String input)\n" + 
    		"        {\n" + 
    		"            try\n" + 
    		"            {\n" + 
    		"                MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    		"                byte[] messageDigest = md.digest(input.getBytes());\n" + 
    		"                BigInteger number = new BigInteger(1,messageDigest);\n" + 
    		"                return number.toString(16);\n" + 
    		"            }\n" + 
    		"            catch(NoSuchAlgorithmException e)\n" + 
    		"            {\n" + 
    		"                throw new RuntimeException(e);\n" + 
    		"            }\n" + 
    		"        }\n" + 
    		"</pre></code>\n" + 
    		"</blockquote><br />\n" + 
    		"ty so much, never thought of using BigInteger, best solution ever :) (after the PHP solution in 1 line :P)          </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/1688' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/1688' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    		"\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>Ismael</a></div>\n" + 
    		"                    <div>2008-11-24 11:17:28</div>\n" + 
    		"                </div>\n" + 
    		"\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2></h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                Thank you very much, it is really useful.           </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/2624' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/2624' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    		"\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://golovach.net'>Golovach Ivan</a></div>\n" + 
    		"                    <div>2008-11-27 09:49:17</div>\n" + 
    		"                </div>\n" + 
    		"\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>error desicion</h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                BAD TEST:<br />\n" + 
    		"<br />\n" + 
    		"public class CheckSumUtils {<br />\n" + 
    		"<br />\n" + 
    		"\n" + 
    		"    public static String calcPlayerPasswordChecksum(String pass) {<br />\n" + 
    		"        byte[] passBytes = pass.getBytes();<br />\n" + 
    		"        try {<br />\n" + 
    		"            MessageDigest algorithm = MessageDigest.getInstance(&quot;MD5&quot;);<br />\n" + 
    		"            algorithm.reset();<br />\n" + 
    		"\n" + 
    		"            algorithm.update(passBytes);<br />\n" + 
    		"            MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);<br />\n" + 
    		"            byte[] messageDigest = md.digest(passBytes);<br />\n" + 
    		"            BigInteger number = new BigInteger(1, messageDigest);<br />\n" + 
    		"            return number.toString(16).toUpperCase();<br />\n" + 
    		"\n" + 
    		"        } catch (NoSuchAlgorithmException e) {<br />\n" + 
    		"            throw new Error(&quot;invalid JRE: have not &#039;MD5&#039; impl.&quot;, e);<br />\n" + 
    		"        }<br />\n" + 
    		"    }<br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"    public static void main(String[] args) {<br />\n" + 
    		"        System.out.println(calcPlayerPasswordChecksum(&quot;a&quot;));<br />\n" + 
    		"        System.out.println(calcPlayerPasswordChecksum(&quot;aa&quot;));<br />\n" + 
    		"        System.out.println(calcPlayerPasswordChecksum(&quot;aaa&quot;));<br />\n" + 
    		"\n" + 
    		"    }<br />\n" + 
    		"}<br />\n" + 
    		"<br />\n" + 
    		"running this test return answ:<br />\n" + 
    		"CC175B9C0F1B6A831C399E269772661<br />\n" + 
    		"4124BC0A9335C27F086F24BA207A4912<br />\n" + 
    		"47BCE5C74F589F4867DBD57E9CA9F808<br />\n" + 
    		"<br />\n" + 
    		"so, arg &#039;a&#039; translate to 31 (not 32) lenth result :(          </div>\n" + 
    		"\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/2633' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/2633' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>Paul Uszak</a></div>\n" + 
    		"\n" + 
    		"                    <div>2009-02-15 14:26:57</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2></h2>\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                I have to side with Ivan - the Big Integer approach does not seem to work properly.  I did this:-<br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"public static void main(String[] args) throws NoSuchAlgorithmException {<br />\n" + 
    		"        MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);<br />\n" + 
    		"        <br />\n" + 
    		"        <br />\n" + 
    		"        for (int i = 0; i &lt; 1E+4; i++) {<br />\n" + 
    		"\n" + 
    		"            byte[] messageDigest = md.digest(new Date().toString().getBytes());<br />\n" + 
    		"            BigInteger number = new BigInteger(1, messageDigest);<br />\n" + 
    		"            System.out.println(number.toString(16));<br />\n" + 
    		"        }<br />\n" + 
    		"    }<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"and while looking at the output, came across these MD5s:-<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"8150f16d3efeddda79787fb9e8a235<br />\n" + 
    		"8150f16d3efeddda79787fb9e8a235<br />\n" + 
    		"8150f16d3efeddda79787fb9e8a235<br />\n" + 
    		"8150f16d3efeddda79787fb9e8a235<br />\n" + 
    		"4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    		"4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    		"\n" + 
    		"4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    		"4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"I&#039;m not an expert and don&#039;t really understand how it works, but I thought that all MD5s were the same length...           </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/3347' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/3347' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"\n" + 
    		"        <!-- start of reply -->\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://www.spiration.co.uk'>Mr. Pickles</a></div>\n" + 
    		"                    <div>2009-02-16 01:37:54</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2>leading zeroes don't matter!</h2>\n" + 
    		"\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                You could argue that leading zeroes are insignificant. Depending on how you use the hash bytes, they may or may not matter. Here is an easy way to check a user supplied password against a saved hash value;<br />\n" + 
    		"<br />\n" + 
    		"<br />\n" + 
    		"MessageDigest m = MessageDigest.getInstance(&quot;SHA&quot;); // or MD5<br />\n" + 
    		"BigInteger supplied = new BigInteger(1, m.digest(password.getBytes()));<br />\n" + 
    		"\n" + 
    		"BigInteger checkval = new BigInteger(stored, 16);<br />\n" + 
    		"if (supplied.equals(checkval)) { <br />\n" + 
    		"    // do something<br />\n" + 
    		"};<br />\n" + 
    		"<br />\n" + 
    		"Where &#039;password&#039; is the user supplied String, and &#039;stored&#039; is the String of the stored hash. You could easily combine it into a one line statement, but this is very clear and easy to read (besides which, you need to wrap in a try/catch anyway).<br />\n" + 
    		"\n" + 
    		"<br />\n" + 
    		"By viewing the stored hash and the supplied hash as BigIntegers, you can check for equality easily, and not have to worry about leading zeroes in the stored hash value.<br />\n" + 
    		"<br />\n" + 
    		"My 2 cents.<br />\n" + 
    		"            </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/3364' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/3364' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"        <!-- start of reply -->\n" + 
    		"\n" + 
    		"        <div class='reply'>\n" + 
    		"            <div class='reply-summary'>\n" + 
    		"                <div class='reply-label'>\n" + 
    		"                    <div><a href='http://'>conzone</a></div>\n" + 
    		"                    <div>2009-05-25 19:29:02</div>\n" + 
    		"                </div>\n" + 
    		"                <div class='reply-title'>   \n" + 
    		"                    <h2></h2>\n" + 
    		"\n" + 
    		"                </div>\n" + 
    		"            </div>\n" + 
    		"            <div class='reply-text'>\n" + 
    		"                I had also attempted to use the code in this thread, though several of you are correct that the MD5 that is generated is not a consistent 32 char hex. In several tests that I had run it wasn&#039;t just the leading 0s being chopped off either it was characters in the middle of the hash. I would get variable length hashes 30, 31, 32 chars depending on the input data.<br />\n" + 
    		"<br />\n" + 
    		"My suggestion if you&#039;re just looking for a solution to generate consistent MD5 or other hashes and not worrying about trying to write your own implementation is to use the Apache Commons Codec package to do this for you. Add this library to your project.<br />\n" + 
    		"<br />\n" + 
    		"<b>Apache Commons Codec Home</b><br />\n" + 
    		"\n" + 
    		"<a href='http://commons.apache.org/codec/'>http://commons.apache.org/codec/</a><br />\n" + 
    		"<br />\n" + 
    		"The specific class you will want to use is DigestUtils. Here is a link to the javadoc<br />\n" + 
    		"<a href='http://commons.apache.org/codec/api-release/org/apache/commons/codec/digest/DigestUtils.html'>DigestUtils JavaDoc</a><br />\n" + 
    		"<br />\n" + 
    		"This is what your code will now look like to achieve the same as above.<br />\n" + 
    		"<br />\n" + 
    		"<code><pre>\n" + 
    		"String sessionid = &quot;12345&quot;;\n" + 
    		"String md5 = DigestUtils.md5Hex(sessionid);\n" + 
    		"</pre></code>\n" + 
    		"<br />\n" + 
    		"\n" + 
    		"Result: 827CCB0EEA8A706C4C34A16891F84E7B<br />\n" + 
    		"<br />\n" + 
    		"Hope this helps.<br />\n" + 
    		"<br />\n" + 
    		"Cheers,<br />\n" + 
    		"<br />\n" + 
    		"B           </div>\n" + 
    		"                        <div id='reply-tools'>\n" + 
    		"                <a href='http://www.spiration.co.uk/reply/r/4369' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    		"        </div>\n" + 
    		"\n" + 
    		"            <!-- end of reply -->\n" + 
    		"            <!-- last bit of adsense -->\n" + 
    		"            </div>\n" + 
    		"    </div>\n" + 
    		"</body>\n" + 
    		"</html>\n" + 
    		"                <div id='footer'>\n" + 
    		"            This site built with <a href='http://torkalot.sourceforge.net'>Torkalot</a> - an open source groupware project. \n" + 
    		"                </div>\n" + 
    		"\n" + 
    		"</body>\n" + 
    		"</html>\n" + 
    		"";
    
    public static final String testHtml2="<!dOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n" + 
    "<html>\n" + 
    "<head>\n" + 
    "<title>Java md5 example with MessageDigest</title>\n" + 
    "        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' lang='en'>\n" + 
    "        <script type='text/javascript' src='http://www.spiration.co.uk/js/channels.js'></script>\n" + 
    "        <link rel='stylesheet' type='text/css' href='http://www.spiration.co.uk/css/normalize.css' />\n" + 
    "        <link rel='stylesheet' type='text/css' href='http://www.spiration.co.uk/css/torkalot.css' />\n" + 
    "</head>\n" + 
    "<body>\n" + 
    "        <div id='breadcrumbstrip'>\n" + 
    "\n" + 
    "                        <h2 id='breadcrumb'><a href='http://www.spiration.co.uk/channel/1'>Spiration Home</a> > <a href='http://www.spiration.co.uk/channel/66'>Computing</a> > <a href='http://www.spiration.co.uk/channel/122'>Programming</a> > <a href='http://www.spiration.co.uk/channel/131'>Java</a> > </h2>\n" + 
    "                    <span id='loginstrip'><div>\n" + 
    "        <form action='http://www.spiration.co.uk/login.php' method='post'>\n" + 
    "\n" + 
    "           <div class='stripinput'><label>user</label><input type='text' name='username'></input></div>\n" + 
    "           <div class='stripinput'><label>password</label> <input type='password' name='password'></input></div>\n" + 
    "       <div class='stripinput'><input class='minisubmitbutton' type='image' name='submit' value='submit' src='http://www.spiration.co.uk/images/icon_login_ccc.gif' alt='login button' /></input></div>\n" + 
    "    <div class='stripinput'><span class='smalllink'><a href='#'>forgotten</a></span></div>\n" + 
    "    <div class='stripinput'><a class='smalllink' href='http://www.spiration.co.uk/join'>join</a></div>\n" + 
    "        </form>\n" + 
    "\n" + 
    "</div>\n" + 
    "</span>\n" + 
    "                </div>\n" + 
    "</div>\n" + 
    "<div id='leftcolumn'>\n" + 
    "<script type='text/javascript'><!--\n" + 
    "google_ad_client = 'pub-5779114772423033';\n" + 
    "//160x600, created 1/1/08\n" + 
    "google_ad_slot = '0786182679';\n" + 
    "google_ad_width = 160;\n" + 
    "google_ad_height = 600;\n" + 
    "//--></script>\n" + 
    "<script type='text/javascript'\n" + 
    "src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>\n" + 
    "</script>\n" + 
    " </div>\n" + 
    "    <div id='post'>\n" + 
    "        <div id='post-head'>\n" + 
    "\n" + 
    "            <div id='post-title'>\n" + 
    "                <h1>Java md5 example with MessageDigest</h1>\n" + 
    "                <span id='poster'>chris (2004-09-09 11:51:40)</span>\n" + 
    "            </div>\n" + 
    "            <div id='post-info'>\n" + 
    "                <div>82171 views</div>\n" + 
    "                <div>13 replies</div>\n" + 
    "\n" + 
    "            </div>\n" + 
    "        </div>\n" + 
    "        <div class='post-text'>\n" + 
    "            <!--img class='addstrip' src='http://www.spiration.co.uk/images/468x15_4.gif' /-->\n" + 
    "<div class='square'>\n" + 
    "<script type='text/javascript'><!--\n" + 
    "google_ad_client = 'pub-5779114772423033';\n" + 
    "/* 250x250, created 2/25/08 */\n" + 
    "google_ad_slot = '2909226682';\n" + 
    "google_ad_width = 250;\n" + 
    "google_ad_height = 250;\n" + 
    "//-->\n" + 
    "</script>\n" + 
    "<script type='text/javascript'\n" + 
    "src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>\n" + 
    "</script>\n" + 
    "</div>\n" + 
    "            This is a quick tip for implementing md5 encryption in java. We use the MessageDigest class in the java.security package and some string manipulation to turn the plain text into a byte array. The digest is then updated from the bytes from the byte array and a hash computation is conducted upon them. To quote from the Sun java api docs, The MessageDigest class provides applications the functionality of a message digest algorithm, such as MD5 or SHA. Message digests are secure one-way hash functions that take arbitrary-sized data and output a fixed-length hash value. <br />\n" + 
    "\n" + 
    "<br />\n" + 
    "Anyway the md5 example code below takes a session id (this is just a string which I wanted to encrypt - It could just as easily be a document, say a lump of xml or any old bit of text). This session id is pulled into the bytes array, defaultBytes and then the MessageDigest is instantiated as an instance of an md5 encryption.<br />\n" + 
    "<br />\n" + 
    "Java developers who have come over from PERL or PHP often get frustrated with such a longwinded means of running what could simply be a single line of code, however the snippet below could be wrapped into an md5sum class which conducts the encryption and simply returns a string of cipher text.<br />\n" + 
    "<code><pre>\n" + 
    "include java.security.*;\n" + 
    "\n" + 
    "... etc\n" + 
    "\n" + 
    "sessionid=&quot;12345&quot;;\n" + 
    "        \n" + 
    "byte[] defaultBytes = sessionid.getBytes();\n" + 
    "try{\n" + 
    "    MessageDigest algorithm = MessageDigest.getInstance(&quot;MD5&quot<img class='emote' src='http://www.spiration.co.uk/images/smilies/wink.gif'/>;\n" + 
    "    algorithm.reset();\n" + 
    "    algorithm.update(defaultBytes);\n" + 
    "    byte messageDigest[] = algorithm.digest();\n" + 
    "            \n" + 
    "    StringBuffer hexString = new StringBuffer();\n" + 
    "    for (int i=0;i&lt;messageDigest.length;i++) {\n" + 
    "        hexString.append(Integer.toHexString(0xFF &amp; messageDigest[i]));\n" + 
    "    }\n" + 
    "    String foo = messageDigest.toString();\n" + 
    "    System.out.println(&quot;sessionid &quot;+sessionid+&quot; md5 version is &quot;+hexString.toString());\n" + 
    "    sessionid=hexString+&quot;&quot;;\n" + 
    "}catch(NoSuchAlgorithmException nsae){\n" + 
    "            \n" + 
    "}\n" + 
    "\n" + 
    "</pre></code>\n" + 
    "<br />\n" + 
    "Remember to import the java.security package. The original plain text and cipher text strings are echod to the java console just to demonstrate what has happened.<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "Hope that&#039;s useful,<br />\n" + 
    "<br />\n" + 
    "christo<br />\n" + 
    "<br />\n" + 
    "follow me on twitter: <a href='http://www.twitter.com/planet_guru'>http://www.twitter.com/planet_guru</a>       </div>\n" + 
    "\n" + 
    "                <div id='post-submissions'>\n" + 
    "            \n" + 
    "<a href='http://digg.com/submit?phase=2&url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Digg it!'><img src='http://www.spiration.co.uk/images/add_to_digg.jpg' alt='Digg it!' border='0'></a>\n" + 
    "\n" + 
    "<a href='http://slashdot.org/submit.pl' title='Submit to Slashdot'><img src='http://www.spiration.co.uk/images/add_to_slashdot.jpg' alt='Submit to Slashdot' border='0'></a>\n" + 
    "\n" + 
    "<a href='http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&Title=Java md5 example with MessageDigest' title='Add it to BinkList'><img src='http://www.spiration.co.uk/images/add_to_binklist.jpg' border='0' alt='Add to Blinklist'></a>\n" + 
    "\n" + 
    "<a href='http://del.icio.us/post?url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Del.Icio.Us'><img src='http://www.spiration.co.uk/images/add_to_delicious.jpg' border='0' alt='Del.icio.us'></a>\n" + 
    "\n" + 
    "<a href='http://www.newsvine.com/_tools/seed&save?u=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&h=Java md5 example with MessageDigest' title='Add it to NewsVine'><img src='http://www.spiration.co.uk/images/add_to_newsvine.jpg' border='0' alt='Add to Newsvine'></a>\n" + 
    "\n" + 
    "<a href='http://technorati.com/faves?add=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Add to Technorati'><img src='http://www.spiration.co.uk/images/add_to_technorati.jpg' border='0' alt='Add to Technorati'></a>\n" + 
    "\n" + 
    "<a href='http://www.google.com/bookmarks/mark?op=add&bkmk=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&title=Java md5 example with MessageDigest' title='Add it to Google Bookmarks'><img src='http://www.spiration.co.uk/images/add_to_google.jpg' border='0' alt='Add it to Google Bookmarks'></a>\n" + 
    "\n" + 
    "<a href='http://ma.gnolia.com/bookmarklet/add?url=http://www.spiration.co.uk/post/1199/Java md5 example with MessageDigest&description=Java md5 example with MessageDigest' title='Add to Magnolia'><img src='http://www.spiration.co.uk/images/add_to_magnolia.jpg' alt='Add to Magnolia' border='0'></a>\n" + 
    "                </div>\n" + 
    "                <div id='post-tools'>\n" + 
    "            <a href='http://www.spiration.co.uk/reply/p/1199' title='reply to this post'/>comment</a>       </div><!-- end post tools-->\n" + 
    "    </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href=''>gipak</a></div>\n" + 
    "                    <div>2004-09-23 09:11:47</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>not exactly correct</h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "\n" + 
    "            <div class='reply-text'>\n" + 
    "                if you use Integer.toHexString(int a), if a&gt;=0 and a&lt;=15 you will get a String consisting of only one char!!!! you need to do something like this:<br />\n" + 
    "<br />\n" + 
    "<code><pre>\n" + 
    "StringBuffer sb=new StringBuffer();\n" + 
    "for (int i = 0; i &lt; bytes.length; i++) {\n" + 
    "     String hex=Integer.toHexString(0xff &amp; bytes[i]);\n" + 
    "     if(hex.length()==1) sb.append(&#039;0&#039;);\n" + 
    "     sb.append(hex);\n" + 
    "}\n" + 
    "</pre></code>           </div>\n" + 
    "\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1269' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    "\n" + 
    "                    <div>2006-12-18 16:59:38</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>Java md5 example with MessageDigest - - immer 32 z</h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                Vielen Dank f&uuml;r dieses Beispiel,<br />\n" + 
    "\n" + 
    "ich bin mal so frei und hab den Code aufbereitet, das er passt.<br />\n" + 
    "D.h. es kommt als Ergebnis immer ein g&uuml;ltiger 32 Zeichel&auml;nge MD5-String raus.<br />\n" + 
    "<br />\n" + 
    "<code><pre>\n" + 
    "import java.security.*;\n" + 
    "\n" + 
    "... etc\n" + 
    "\n" + 
    "String pass = &quot;123456&quot;;\n" + 
    "\n" + 
    "\n" + 
    "byte[] defaultBytes = pass.getBytes();\n" + 
    "try{\n" + 
    "     MessageDigest algorithm = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    "     algorithm.reset();\n" + 
    "     algorithm.update(defaultBytes);\n" + 
    "     byte messageDigest[] = algorithm.digest();\n" + 
    "\n" + 
    "     StringBuffer hexString = new StringBuffer();\n" + 
    "     for (int i=0;i&lt;messageDigest.length;i++) {\n" + 
    "    String hex = Integer.toHexString(0xFF &amp; messageDigest[i]); \n" + 
    "    if(hex.length()==1)\n" + 
    "    hexString.append(&#039;0&#039;);\n" + 
    "\n" + 
    "    hexString.append(hex);\n" + 
    "     }\n" + 
    "                             \n" + 
    "                             \n" + 
    "     //*** Testausgabe\n" + 
    "     System.out.println(&quot;pass &quot;+pass+&quot;   md5 version is &quot;+hexString.toString());\n" + 
    "     pass = hexString+&quot;&quot;;\n" + 
    "}\n" + 
    "catch(NoSuchAlgorithmException nsae){\n" + 
    "                                            \n" + 
    "}\n" + 
    "\n" + 
    "</pre></code>\n" + 
    "<br />\n" + 
    "Danke an Euch Zwei. ICh w&auml;re da selbst nicht drauf gekommen.           </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1416' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    "                    <div>2006-11-28 16:43:09</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>Thanks!</h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "\n" + 
    "            <div class='reply-text'>\n" + 
    "                These codes were very useful to me !<br />\n" + 
    "Thank you!          </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1413' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    "                    <div>2007-03-30 09:36:31</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2></h2>\n" + 
    "                </div>\n" + 
    "\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                The following code works well if you only need to print the digest value:<br />\n" + 
    "<br />\n" + 
    "for (byte b : md.digest())<br />\n" + 
    "  System.out.printf(&quot;%02x&quot;, 0xFF&amp;b);          </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1426' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>anonymous</a></div>\n" + 
    "                    <div>2007-03-30 15:38:19</div>\n" + 
    "\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>SHA-256</h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                Cheers.<br />\n" + 
    "<br />\n" + 
    "<code><pre>\n" + 
    "\n" + 
    "package test;\n" + 
    "\n" + 
    "import java.security.MessageDigest;\n" + 
    "import java.security.NoSuchAlgorithmException;\n" + 
    "\n" + 
    "public class MD5Test\n" + 
    "{\n" + 
    "    public static void main(String[] args)\n" + 
    "    {\n" + 
    "        String md5val = &quot;&quot;;\n" + 
    "        MessageDigest algorithm = null;\n" + 
    "\n" + 
    "        try\n" + 
    "        {\n" + 
    "            algorithm = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    "        }\n" + 
    "        catch (NoSuchAlgorithmException nsae)\n" + 
    "        {\n" + 
    "            System.out.println(&quot;Cannot find digest algorithm&quot;);\n" + 
    "            System.exit(1);\n" + 
    "        }\n" + 
    "        \n" + 
    "        for (String arg : args)\n" + 
    "        {\n" + 
    "            byte[] defaultBytes = arg.getBytes();\n" + 
    "            algorithm.reset();\n" + 
    "            algorithm.update(defaultBytes);\n" + 
    "            byte messageDigest[] = algorithm.digest();\n" + 
    "            StringBuffer hexString = new StringBuffer();\n" + 
    "\n" + 
    "            for (int i = 0; i &lt; messageDigest.length; i++)\n" + 
    "            {\n" + 
    "                String hex = Integer.toHexString(0xFF &amp; messageDigest[i]);\n" + 
    "                if (hex.length() == 1)\n" + 
    "                {\n" + 
    "                    hexString.append(&#039;0&#039;);\n" + 
    "                }\n" + 
    "                hexString.append(hex);\n" + 
    "            }\n" + 
    "            md5val = hexString.toString();\n" + 
    "            System.out.println(&quot;MD5 (&quot;&quot; + arg + &quot;&quot;) = &quot; + md5val);\n" + 
    "        }\n" + 
    "    }\n" + 
    "}\n" + 
    "\n" + 
    "</pre></code>\n" + 
    "<br />\n" + 
    "this lets you test on the command line against the command line md5 command to check it works correctly:<br />\n" + 
    "<br />\n" + 
    "<code><pre>\n" + 
    "g@h ~/bin$ md5 -s dammitjanet\n" + 
    "MD5 (&quot;dammitjanet&quot;) = ea309a2eb146a4d8bdf8946c4df23c71\n" + 
    "g@h ~/bin$ java -cp . test.MD5Test dammitjanet\n" + 
    "MD5 (&quot;dammitjanet&quot;) = ea309a2eb146a4d8bdf8946c4df23c71\n" + 
    "</pre></code>\n" + 
    "<br />\n" + 
    "Please note that if you are using MD5 for authentication means, you really really should consider using a salt alongside the value you wish to create an md5 of to increase security. Better to use SHA-256 although you need to use more characters in your database password table.<br />\n" + 
    "<br />\n" + 
    "        algorithm = MessageDigest.getInstance(&quot;SHA-256&quot;);<br />\n" + 
    "\n" + 
    "<br />\n" + 
    "<code><pre>\n" + 
    "g@h ~/bin$ java -cp . test.MD5Test &quot;bark at the moon&quot;  \n" + 
    "SHA-256 (&quot;bark at the moon&quot;) = a5bb786220762b74c9569cd9f150a4176f9da3c2ac29d776a65487b2a77d4429\n" + 
    "</pre></code>\n" + 
    "            </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1427' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href=''>iandesouza</a></div>\n" + 
    "                    <div>2007-05-17 17:27:19</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>shorter version</h2>\n" + 
    "\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                You can use BigInteger to do the byte array conversion....<br />\n" + 
    "<code><pre>\n" + 
    "    static String getMd5Digest(String input)\n" + 
    "        {\n" + 
    "            try\n" + 
    "            {\n" + 
    "                MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    "                byte[] messageDigest = md.digest(input.getBytes());\n" + 
    "                BigInteger number = new BigInteger(1,messageDigest);\n" + 
    "                return number.toString(16);\n" + 
    "            }\n" + 
    "            catch(NoSuchAlgorithmException e)\n" + 
    "            {\n" + 
    "                throw new RuntimeException(e);\n" + 
    "            }\n" + 
    "        }\n" + 
    "</pre></code>\n" + 
    "            </div>\n" + 
    "\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1551' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href=''>pedroha</a></div>\n" + 
    "\n" + 
    "                    <div>2007-05-21 19:35:08</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>Short correction</h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                I liked the short version, so I used it but it didn&#039;t match during my testing.<br />\n" + 
    "\n" + 
    "<br />\n" + 
    "I tried with the following input:<br />\n" + 
    "&quot;bbb&quot;: 8F8E0260C64418510CEFB2B06EEE5CD<br />\n" + 
    "<br />\n" + 
    "So I checked against MySQL md5():<br />\n" + 
    "08F8E0260C64418510CEFB2B06EEE5CD<br />\n" + 
    "<br />\n" + 
    "You have to prepend zero&#039;s until you get 32 chars to simulate this behaviour.<br />\n" + 
    "<br />\n" + 
    "Regards,<br />\n" + 
    "\n" + 
    "Pedro<br />\n" + 
    "<br />\n" + 
    "            </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1552' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>jn</a></div>\n" + 
    "                    <div>2008-05-26 06:07:07</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2></h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "\n" + 
    "            <div class='reply-text'>\n" + 
    "                <blockquote class='quote'>You can use BigInteger to do the byte array conversion....<br />\n" + 
    "<code><pre>\n" + 
    "    static String getMd5Digest(String input)\n" + 
    "        {\n" + 
    "            try\n" + 
    "            {\n" + 
    "                MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);\n" + 
    "                byte[] messageDigest = md.digest(input.getBytes());\n" + 
    "                BigInteger number = new BigInteger(1,messageDigest);\n" + 
    "                return number.toString(16);\n" + 
    "            }\n" + 
    "            catch(NoSuchAlgorithmException e)\n" + 
    "            {\n" + 
    "                throw new RuntimeException(e);\n" + 
    "            }\n" + 
    "        }\n" + 
    "</pre></code>\n" + 
    "</blockquote><br />\n" + 
    "ty so much, never thought of using BigInteger, best solution ever :) (after the PHP solution in 1 line :P)          </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/1688' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/1688' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    "\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>Ismael</a></div>\n" + 
    "                    <div>2008-11-24 11:17:28</div>\n" + 
    "                </div>\n" + 
    "\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2></h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                Thank you very much, it is really useful.           </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/2624' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/2624' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    "\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://golovach.net'>Golovach Ivan</a></div>\n" + 
    "                    <div>2008-11-27 09:49:17</div>\n" + 
    "                </div>\n" + 
    "\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>error desicion</h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                BAD TEST:<br />\n" + 
    "<br />\n" + 
    "public class CheckSumUtils {<br />\n" + 
    "<br />\n" + 
    "\n" + 
    "    public static String calcPlayerPasswordChecksum(String pass) {<br />\n" + 
    "        byte[] passBytes = pass.getBytes();<br />\n" + 
    "        try {<br />\n" + 
    "            MessageDigest algorithm = MessageDigest.getInstance(&quot;MD5&quot;);<br />\n" + 
    "            algorithm.reset();<br />\n" + 
    "\n" + 
    "            algorithm.update(passBytes);<br />\n" + 
    "            MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);<br />\n" + 
    "            byte[] messageDigest = md.digest(passBytes);<br />\n" + 
    "            BigInteger number = new BigInteger(1, messageDigest);<br />\n" + 
    "            return number.toString(16).toUpperCase();<br />\n" + 
    "\n" + 
    "        } catch (NoSuchAlgorithmException e) {<br />\n" + 
    "            throw new Error(&quot;invalid JRE: have not &#039;MD5&#039; impl.&quot;, e);<br />\n" + 
    "        }<br />\n" + 
    "    }<br />\n" + 
    "\n" + 
    "<br />\n" + 
    "    public static void main(String[] args) {<br />\n" + 
    "        System.out.println(calcPlayerPasswordChecksum(&quot;a&quot;));<br />\n" + 
    "        System.out.println(calcPlayerPasswordChecksum(&quot;aa&quot;));<br />\n" + 
    "        System.out.println(calcPlayerPasswordChecksum(&quot;aaa&quot;));<br />\n" + 
    "\n" + 
    "    }<br />\n" + 
    "}<br />\n" + 
    "<br />\n" + 
    "running this test return answ:<br />\n" + 
    "CC175B9C0F1B6A831C399E269772661<br />\n" + 
    "4124BC0A9335C27F086F24BA207A4912<br />\n" + 
    "47BCE5C74F589F4867DBD57E9CA9F808<br />\n" + 
    "<br />\n" + 
    "so, arg &#039;a&#039; translate to 31 (not 32) lenth result :(          </div>\n" + 
    "\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/2633' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/2633' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>Paul Uszak</a></div>\n" + 
    "\n" + 
    "                    <div>2009-02-15 14:26:57</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2></h2>\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                I have to side with Ivan - the Big Integer approach does not seem to work properly.  I did this:-<br />\n" + 
    "\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "public static void main(String[] args) throws NoSuchAlgorithmException {<br />\n" + 
    "        MessageDigest md = MessageDigest.getInstance(&quot;MD5&quot;);<br />\n" + 
    "        <br />\n" + 
    "        <br />\n" + 
    "        for (int i = 0; i &lt; 1E+4; i++) {<br />\n" + 
    "\n" + 
    "            byte[] messageDigest = md.digest(new Date().toString().getBytes());<br />\n" + 
    "            BigInteger number = new BigInteger(1, messageDigest);<br />\n" + 
    "            System.out.println(number.toString(16));<br />\n" + 
    "        }<br />\n" + 
    "    }<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "\n" + 
    "<br />\n" + 
    "and while looking at the output, came across these MD5s:-<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "8150f16d3efeddda79787fb9e8a235<br />\n" + 
    "8150f16d3efeddda79787fb9e8a235<br />\n" + 
    "8150f16d3efeddda79787fb9e8a235<br />\n" + 
    "8150f16d3efeddda79787fb9e8a235<br />\n" + 
    "4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    "4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    "\n" + 
    "4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    "4e9b15f5c1df1905f63faec3bb6a49d2<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "I&#039;m not an expert and don&#039;t really understand how it works, but I thought that all MD5s were the same length...           </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/3347' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/3347' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "\n" + 
    "        <!-- start of reply -->\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://www.spiration.co.uk'>Mr. Pickles</a></div>\n" + 
    "                    <div>2009-02-16 01:37:54</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2>leading zeroes don't matter!</h2>\n" + 
    "\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                You could argue that leading zeroes are insignificant. Depending on how you use the hash bytes, they may or may not matter. Here is an easy way to check a user supplied password against a saved hash value;<br />\n" + 
    "<br />\n" + 
    "<br />\n" + 
    "MessageDigest m = MessageDigest.getInstance(&quot;SHA&quot;); // or MD5<br />\n" + 
    "BigInteger supplied = new BigInteger(1, m.digest(password.getBytes()));<br />\n" + 
    "\n" + 
    "BigInteger checkval = new BigInteger(stored, 16);<br />\n" + 
    "if (supplied.equals(checkval)) { <br />\n" + 
    "    // do something<br />\n" + 
    "};<br />\n" + 
    "<br />\n" + 
    "Where &#039;password&#039; is the user supplied String, and &#039;stored&#039; is the String of the stored hash. You could easily combine it into a one line statement, but this is very clear and easy to read (besides which, you need to wrap in a try/catch anyway).<br />\n" + 
    "\n" + 
    "<br />\n" + 
    "By viewing the stored hash and the supplied hash as BigIntegers, you can check for equality easily, and not have to worry about leading zeroes in the stored hash value.<br />\n" + 
    "<br />\n" + 
    "My 2 cents.<br />\n" + 
    "            </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/3364' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a><a href='http://www.spiration.co.uk/editreply/3364' id='edit-link' title='edit this reply'/><img alt='edit reply' src='http://www.spiration.co.uk/images/icon_edit.png'></img></a>                         </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "        <!-- start of reply -->\n" + 
    "\n" + 
    "        <div class='reply'>\n" + 
    "            <div class='reply-summary'>\n" + 
    "                <div class='reply-label'>\n" + 
    "                    <div><a href='http://'>conzone</a></div>\n" + 
    "                    <div>2009-05-25 19:29:02</div>\n" + 
    "                </div>\n" + 
    "                <div class='reply-title'>   \n" + 
    "                    <h2></h2>\n" + 
    "\n" + 
    "                </div>\n" + 
    "            </div>\n" + 
    "            <div class='reply-text'>\n" + 
    "                I had also attempted to use the code in this thread, though several of you are correct that the MD5 that is generated is not a consistent 32 char hex. In several tests that I had run it wasn&#039;t just the leading 0s being chopped off either it was characters in the middle of the hash. I would get variable length hashes 30, 31, 32 chars depending on the input data.<br />\n" + 
    "<br />\n" + 
    "My suggestion if you&#039;re just looking for a solution to generate consistent MD5 or other hashes and not worrying about trying to write your own implementation is to use the Apache Commons Codec package to do this for you. Add this library to your project.<br />\n" + 
    "<br />\n" + 
    "<b>Apache Commons Codec Home</b><br />\n" + 
    "\n" + 
    "<a href='http://commons.apache.org/codec/'>http://commons.apache.org/codec/</a><br />\n" + 
    "<br />\n" + 
    "The specific class you will want to use is DigestUtils. Here is a link to the javadoc<br />\n" + 
    "<a href='http://commons.apache.org/codec/api-release/org/apache/commons/codec/digest/DigestUtils.html'>DigestUtils JavaDoc</a><br />\n" + 
    "<br />\n" + 
    "This is what your code will now look like to achieve the same as above.<br />\n" + 
    "<br />\n" + 
    "<code><pre>\n" + 
    "String sessionid = &quot;12345&quot;;\n" + 
    "String md5 = DigestUtils.md5Hex(sessionid);\n" + 
    "</pre></code>\n" + 
    "<br />\n" + 
    "\n" + 
    "Result: 827CCB0EEA8A706C4C34A16891F84E7B<br />\n" + 
    "<br />\n" + 
    "Hope this helps.<br />\n" + 
    "<br />\n" + 
    "Cheers,<br />\n" + 
    "<br />\n" + 
    "B           </div>\n" + 
    "                        <div id='reply-tools'>\n" + 
    "                <a href='http://www.spiration.co.uk/reply/r/4369' title='login and click here to reply to this post'/><img alt='reply icon' src='http://www.spiration.co.uk/images/icon_reply.png'></img></a>                           </div><!-- end reply tools-->\n" + 
    "        </div>\n" + 
    "\n" + 
    "            <!-- end of reply -->\n" + 
    "            <!-- last bit of adsense -->\n" + 
    "            </div>\n" + 
    "    </div>\n" + 
    "</body>\n" + 
    "</html>\n" + 
    "                <div id='footer'>\n" + 
    "            This site built with <a href='http://torkalot.sourceforge.net'>Torkalot</a> - an open source groupware project. \n" + 
    "                </div>\n" + 
    "\n" + 
    "</body>\n" + 
    "</html>\n" + 
    "";
}
